617f3d2a3d16faa6d266397ac939c4b815253559,src/test/java/org/sonar/plugins/findbugs/FindbugsSensorTest.java,FindbugsSensorTest,should_execute_findbugs_but_not_find_violation,#,236

Before Change



  @Test
  public void should_execute_findbugs_but_not_find_violation() throws Exception {
    Project project = createProject();
    FindbugsExecutor executor = mock(FindbugsExecutor.class);

    BugInstance bugInstance = getBugInstance("THIS_RULE_DOES_NOT_EXIST", 107);
    Collection<ReportedBug> collection = Arrays.asList(new ReportedBug(bugInstance));
    when(executor.execute(false, false)).thenReturn(collection);
    JavaResourceLocator javaResourceLocator = mockJavaResourceLocator();
    when(javaResourceLocator.classFilesToAnalyze()).thenReturn(Lists.newArrayList(new File("file")));

    FindbugsSensor analyser = new FindbugsSensor(createRulesProfileWithActiveRules(false, false, false, false),
        FakeRuleFinder.createWithAllRules(), perspectives, executor,
        javaResourceLocator, fs,byteCodeResourceLocator);
    analyser.analyse(project, context);

    verify(executor).execute(false, false);
    verify(issuable, never()).addIssue(any(Issue.class));

After Change


    //JavaResourceLocator javaResourceLocator = mockJavaResourceLocator();
    when(javaResourceLocator.classFilesToAnalyze()).thenReturn(Lists.newArrayList(new File("file")));

    pico.addComponent(createRulesProfileWithActiveRules(false, false, false, false));

    FindbugsSensor analyser = pico.getComponent(FindbugsSensor.class);
    analyser.execute(sensorContext);

    verify(executor).execute(false, false);
    verify(sensorContext, never()).newIssue();